// base
import Taro, { Component } from '@tarojs/taro'
import { View, Image } from '@tarojs/components'
import { AtActivityIndicator } from 'taro-ui'
// less
import './index.less'

class ButtonPostJobs extends Component {
  componentWillMount() {
    // onLoad
  }

  componentDidMount() {
    // onready
  }

  componentWillUnmount() {
    // onUnload
  }

  componentWillReceiveProps(nextprops) {}

  delay(time = 0) {
    return new Promise(resolve => {
      setTimeout(() => {
        resolve()
      }, time)
    })
  }

  render() {
    const { text, okLoading } = this.props
    return (
      <View className="BtmFixedBtn_id92839">
        <View className="ButtonPostJobs_id67592">
          <View className="preview" onClick={this.props.onPrew}>
            <Image
              src="https://imagesize.hrwork.com/sp/files/8fdcd79a-e509-4169-9910-5774dcd21de3.png"
              className="preview-image"
            />
            <View className="preview-text">预览</View>
          </View>
          <View className="postjobs" onClick={this.props.onTap}>
            {okLoading ? <AtActivityIndicator color="#fff" /> : text || '发布岗位'}
          </View>
        </View>
      </View>
    )
  }
}

export default ButtonPostJobs
